using UnityEngine;
using System.Collections;

public class Spawner : MonoBehaviour 
{
	float timer;
	float limit;
	
	public GameObject meteor;
	public GameObject grasshopper;
	
	void Start () 
	{
		limit = Random.Range(1.0f, 3.5f);
	}
	
	void Update () 
	{
		timer += Time.deltaTime;
		
		if(timer >= limit)
		{
			Instantiate(meteor, new Vector3(transform.position.x, transform.position.y, transform.position.z), gameObject.transform.rotation);
			Instantiate(grasshopper, new Vector3(transform.position.x, Random.Range(-4, 5), transform.position.z), gameObject.transform.rotation);
			timer = 0;
			limit = Random.Range(1.0f, 3.5f);
		}
	}
}
